import { useEffect, useState } from "react"
import { message, Table } from "antd"
import request from '@/utils/Request'
import { useUserStore } from '@/store'
const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
  },
];
const Test = () => {
  const [dataSource, setDataSource] = useState([])
  const { setUser } = useUserStore()
  useEffect(() => {
    request.post('/mock/table', {}).then((res) => {
      console.log(res, 'res')
      if (res.code === 200) {
        setDataSource(res.data)
        return
      }
      setUser(null)
    })
  }, [])
  return <div>
    <Table dataSource={dataSource} columns={columns}></Table>
  </div>
}

export default Test